import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const login = r => require.ensure([], () => r(require('@/page/login')), 'login');
const manage = r => require.ensure([], () => r(require('@/page/manage')), 'manage');
const home = r => require.ensure([], () => r(require('@/page/home')), 'home');
// const addShop = r => require.ensure([], () => r(require('@/page/addShop')), 'addShop');
// const addGoods = r => require.ensure([], () => r(require('@/page/addGoods')), 'addGoods');;
// const adminSet = r => require.ensure([], () => r(require('@/page/adminSet')), 'adminSet');
// const sendMessage = r => require.ensure([], () => r(require('@/page/sendMessage')), 'sendMessage');
// const explain = r => require.ensure([], () => r(require('@/page/explain')), 'explain');
//课程管理模块
const courseslist = r => require.ensure([], () => r(require('@/page/course/coursesList')), 'courseslist');
const coursefile = r => require.ensure([], () => r(require('@/page/course/courseFile')), 'coursefile');
const addpassage = r => require.ensure([], () => r(require('@/page/course/addPassage')), 'addpassage');
const addbrief = r => require.ensure([], () => r(require('@/page/course/addBrief')), 'addbrief');
//考核模块
const paper = r => require.ensure([], () => r(require('@/page/examine/paper')), 'paper');
const addPaper = r => require.ensure([], () => r(require('@/page/examine/addPaper')), 'addPaper');
const score = r => require.ensure([], () => r(require('@/page/examine/score')), 'score');
//学生管理模块
const addstudent = r => require.ensure([], () => r(require('@/page/student/addStudent')), 'addstudent');
const studentlist = r => require.ensure([], () => r(require('@/page/student/studentList')), 'studentlist');
//学情管理模块
const courseList = r => require.ensure([], () => r(require('@/page/courseList')), 'courseList');
const workList = r => require.ensure([], () => r(require('@/page/workList')), 'workList');
const attendanceList = r => require.ensure([], () => r(require('@/page/attendanceList')), 'attendanceList');
const speedList = r => require.ensure([], () => r(require('@/page/speedList')), 'speedList');
//习题管理模块
const addtext = r => require.ensure([], () => r(require('@/page/test/addtext')), 'addtext');
const exercise = r => require.ensure([], () => r(require('@/page/test/exercise')), 'exercise');
const kindlist = r => require.ensure([], () => r(require('@/page/test/kindlist')), 'kindlist');
const textlist = r => require.ensure([], () => r(require('@/page/test/textlist')), 'textlist');

const routes = [{
    path: '/',
    component: login
},
{
    path: '/manage',
    component: manage,
    name: '',
    children: [{
        path: '',
        component: home,
        meta: [],
    }, {
        path: '/paper',
        component: paper,
        meta: ['考核管理', '历史试题'],
    }, {
        path: '/addPaper',
        component: addPaper,
        meta: ['考核管理', '添加试卷'],
    }, {
        path: '/score',
        component: score,
        meta: ['考核管理', '成绩分析'],
    }, {
        path: '/studentlist',
        component: studentlist,
        meta: ['学生管理模块', '学生列表'],
    }, {
        path: '/addstudent',
        component: addstudent,
        meta: ['学生管理模块', '添加学生'],      
    }, {
        path: '/editstudent/:id',
        component: addstudent,
        meta: ['学生管理模块', '修改学生'],
        // hidden: true
    }, {
        path: '/courseList',
        component: courseList,
        meta: ['学情管理', '课程管理'],
    }, {
        path: '/workList',
        component: workList,
        meta: ['学情管理', '作业管理'],
    }, {
        path: '/attendanceList',
        component: attendanceList,
        meta: ['学情管理', '考勤管理'],
    }, {
        path: '/speedList',
        component: speedList,
        meta: ['学情管理', '学习进度'],
    }, {
        path: '/addtext',
        component: addtext,
        meta: ['习题管理', '添加习题'],
    }, {
        path: '/exercise',
        component: exercise,
        meta: ['习题管理', '习题库'],
    }, {
        path: '/kindlist',
        component: kindlist,
        meta: ['习题管理', '分类列表'],
    }, {
        path: '/textlist',
        component: textlist,
        meta: ['习题管理', '习题列表'],
    }, {
        path: '/courseslist',
        component: courseslist,
        meta: ['课程管理', '课程列表'],
    }, {
        path: '/coursefile',
        component: coursefile,
        meta: ['课程管理', '课程资料'],
    }, {
        path: '/addpassage',
        component: addpassage,
        meta: ['课程管理', '添加章节'],
    }, {
        path: '/addbrief',
        component: addbrief,
        meta: ['课程管理', '添加小结'],
    }]
}
]

export default new Router({
    routes,
    strict: process.env.NODE_ENV !== 'production',
})
